﻿using Coevery.AppFramework;
using Coevery.AppFramework.Messages;
using ICSharpCode.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Coevery.AppFramework.WinForms.Views;

using Coevery.AppFramework;
using Coevery.AppFramework.Messages;
using ICSharpCode.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Coevery.AppFramework.MetadataServiceReference;
using Coevery.AppFramework.Metadata;
using Coevery.AppFramework.WinForms.Controller;
using Coevery.AppFramework.WinForms;
using Coevery.AppFramework.WinForms.MVC;
using Coevery.AppFramework.WinForms.Messages;
using Coevery.AppFramework.WinForms.Views;
using Coevery.AppFramework.Security;
using Coevery.AppFramework.WinForms.Workspaces;
namespace Coevery.Win.InmuebleModule
{
    public class OpenInmuebleReportCommand : ObjectAwareCommand
    {
        // Falta anadir en el addin el path que aqui se indica

        public override void Run()
        {
            var selection = (ISelection)Owner;
            var objectAware = (IObjectAware)Owner;

            IObjectSpace objectSpace = new ODataObjectSpace();
            Guid selectedId = selectedId = objectSpace.GetObjectId(objectAware.ObjectName, selection.SelectedObject);
           
            var parameters = new ActionParameters(objectAware.ObjectName, selectedId, ViewShowType.Show){};
            var controllerName = objectAware.ObjectName;
            App.Instance.Invoke("InmuebleReport", "List", parameters);
            //var message = new ShowScreenMessage("/InmuebleReport/List", "InmuebleReport");
            //EventAggregationManager.SendMessage(message);
        }
    }
}
